package chixing.day10.work;

import java.util.List;

public class OrderProcessingService {
    public void processAndSaveOrder(Order order) {
        List<Order> ordersToSave = order.splitOrder();

        for (Order o : ordersToSave) {
            o.processOrder(); // 处理订单
            saveOrder(o);    // 保存订单
        }
    }

    private void saveOrder(Order order) {
        // 实际保存订单到数据库的逻辑
        System.out.println("保存订单: " + order.getOrderId() +
                ", 数量: " + order.getQuantity());
    }
}
